import Vue from 'vue'
import Vuex from 'vuex'

import state from './state'
import mutations from './mutations'

Vue.use(Vuex)

// let defaultCity = '长沙'
// try{
//   if(localStorage.city) {
//     defaultCity = localStorage.city
//   }
// } catch(e){}

export default new Vuex.Store({
  // state: {
    // 需要使用 try{} catch{} 来捕获错误
    // city: localStorage.city || '北京'
  // },
  state,
  mutations,
  // mutations: {
  //   changeCity(state, city) {
  //     state.city = city;
  //     try {
  //       localStorage.city = city
  //     } catch(e) {}
  //   }
  // },
  actions: {
  },
  modules: {
  }
})
